package com.eastedu.converter;

import com.eastedu.model.ktree.KnowledgeNodeDTO;
import com.eastedu.repository.question.po.QuestionAssociationPO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.MappingTarget;

/**
 * The interface Basic resource file converter.
 *
 * @author zhangzhishuai
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
public interface QuestionKnowledgeConverter {

    /**
     * Update.
     *
     * @param dto the dto
     * @param po  the po
     */
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "type", ignore = true)
    @Mapping(target = "syncState", ignore = true)
    @Mapping(target = "questionId", ignore = true)
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "associationRootName", ignore = true)
    @Mapping(target = "associationRootId", ignore = true)
    @Mapping(target = "associationName", source = "nodeName")
    @Mapping(target = "associationId", ignore = true)
    void update(KnowledgeNodeDTO dto, @MappingTarget QuestionAssociationPO po);
}
